package com.jielin.handling.service.room.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.jielin.handling.entity.mobileapp.MessageNotification;
import com.jielin.handling.entity.room.RoomReserveLogVo;
import com.jielin.handling.mapper.room.RoomReserveLogMapper;
import com.jielin.handling.page.DataGrid;
import com.jielin.handling.service.room.RoomReserveLogService;
import com.jielin.handling.util.StringUtil;

@Service
public class RoomReserveLogServiceimpl implements RoomReserveLogService {
	@Autowired
	private RoomReserveLogMapper reserveLogMapper;

	@Override
	public DataGrid findReserveLogBypoliceId(MessageNotification mNotification) {
		DataGrid dg = new DataGrid();
		if (mNotification == null || StringUtil.isEmpty(mNotification.getPoliceId())) {
			return dg;
		}
		Page<RoomReserveLogVo> startPage = PageHelper.startPage(mNotification.getPageNum(),
				mNotification.getPageSize());// 使用分页插件方法
		reserveLogMapper.findReserveLogBypoliceId(mNotification.getPoliceId());
		dg.setTotal(startPage.getTotal());
		dg.setRows(startPage.getResult());
		return dg;
	}
}
